/*
 * @Author: 四川华西绿舍建材有限公司
 * @Date: 2023-12-08 21:32:32
 * @LastEditors: 陈波
 * @LastEditTime: 2024-01-22 14:56:24
 * @Description: 
 * @FilePath: \graDesign\src\main.ts
 */
import { App as TApp, createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import '@/components/BasicIcon/iconfont.js'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
// 导入字体文件
import '../src/assets/font/dsfont.css'
// 滚动条样式
import '@/assets/scrollbar.css'
// 导入vxe-table
import VXETable from 'vxe-table'
import 'vxe-table/lib/style.css'
import '@/vxeIcon'
import 'xe-utils'
// 自定义全局组件
import Footer from '@/components/Footer/index.vue'
import FaceEnter from '@/components/FaceEnter/index.vue'
import BasicIcon from '@/components/BasicIcon/index.vue'
import subMenu from '@/layout/menus/subMenu.vue'
import BasicTooltip from '@/components/BasicTooltip/index.vue'
import LayoutIndex from '@/components/layoutComp/layoutIndex.vue'
import LayoutDetail from '@/components/layoutComp/layoutDetail.vue'
import BasicTable from '@/components/BasicTable/index.vue'
import BasicTableAuto from '@/components/BasicTableAuto/index.vue'
import BasicDialog from '@/components/BasicDialog/index.vue'
import BasicDateTime from '@/components/BasicDateTime/index.vue'
import WaterMark from '@/components/WaterMark/index.vue'
import BasicCharts from "@/components/BasicCharts/index.vue"
import BasicCard from '@/components/BasicCharts/index.vue'
import BasicDescriptions from '@/components/BasicDescriptions/index.vue'
import BasicDrawer from '@/components/BasicDrawer/index.vue'
// 自定义指令
import isAuth from '@/directive/isAuth'
import adaptive from '@/directive/fixTableHeight'
import autoFocus from '@/directive/autoFocus'
import ClickOutside from '@/directive/clickoutside'

const app = createApp(App)

app.component('Footer', Footer) // 底部组件
app.component('FaceEnter', FaceEnter) // 人脸录入组件
app.component('BasicIcon', BasicIcon) // 基础图标 使用iconfont
app.component('subMenu', subMenu) // 为了能递归调用自身
app.component('BasicTooltip', BasicTooltip) // 文字提示
app.component('LayoutIndex', LayoutIndex) // 列表布局组件
app.component('LayoutDetail', LayoutDetail) // 详情布局组件
app.component('BasicTable', BasicTable) // 基础高度由页面决定的表格
app.component('BasicTableAuto', BasicTableAuto) // 高度自适应的表格
app.component('BasicDialog', BasicDialog) // 对话框组件
app.component('BasicDateTime', BasicDateTime) // 显示时间组件
app.component('WaterMark', WaterMark) // 全局水印组件
app.component('BasicCharts', BasicCharts) // Echarts全局图表组件
app.component('BasicCard', BasicCard) // 卡片组件 包裹BasicCharts
app.component('BasicDescriptions', BasicDescriptions) // 描述组件
app.component('BasicDrawer', BasicDrawer) // 抽屉--高级搜索

function useTable (app: TApp) {
  app.use(VXETable)
}
// 注册vxe-table
app.use(useTable)

// 自定义全局指令
// 按钮权限
app.directive('auth', isAuth)
// 固定表格高度
app.directive('adaptive', adaptive)
// 自动聚焦指令
app.directive('autoFocus', autoFocus)
// 点击区域外触发事件
app.directive('click-outside', ClickOutside)

// element图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.use(router)
app.use(store)
app.use(ElementPlus, { size: 'default', zIndex: 3000, locale: zhCn })
app.mount('#app')
